package com.nut.spp;

import com.nut.spp.interceptor.UniqueNameGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

@Slf4j
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class}, scanBasePackages = {"com.nut.spp"})
@ComponentScan(nameGenerator = UniqueNameGenerator.class)
public class SppApplication {

    public static void main(String[] args) {

        ConfigurableApplicationContext context = SpringApplication.run(SppApplication.class, args);
        Environment environment = context.getBean(Environment.class);
        log.info("ActiveProfile=" + environment.getActiveProfiles()[0]);
        log.info("http://localhost:" + environment.getProperty("local.server.port"));

//        System.out.println(context.getEnvironment().getSystemEnvironment());
//        System.out.println(context.getEnvironment().getSystemProperties());


//        OrderService orderService = context.getBean(OrderService.class);
//        orderService.submit(null, null);


    }

}